/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * RMI skeleton class
 * for class org.apache.harmony.jndi.provider.rmi.registry.RemoteReferenceWrapper
 * Compatible with stub protocol version 1.1/1.2
 *
 * Generated by DRL RMI Compiler (rmic).
 *
 * DO NOT EDIT!!!
 * Contents subject to change without notice!
 */

package org.apache.harmony.jndi.provider.rmi.registry;

import org.apache.harmony.jndi.internal.nls.Messages;

@SuppressWarnings("deprecation")
public final class RemoteReferenceWrapper_Skel implements
        java.rmi.server.Skeleton {

    private static final long interfaceHash = 2534274963554139942L;

    private static final java.rmi.server.Operation[] operations = { new java.rmi.server.Operation(
            "javax.naming.Reference getReference()") //$NON-NLS-1$
    };

    public java.rmi.server.Operation[] getOperations() {
        return operations.clone();
    }

    public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call,
            int opnum, long hash) throws java.lang.Exception {
        if (opnum < 0) {
            if (hash == 3529874867989176284L) {
                opnum = 0;
            } else {
                // jndi.87=Invalid method hash: {0}
                throw new java.rmi.UnmarshalException(Messages.getString(
                        "jndi.87", hash)); //$NON-NLS-1$
            }
        } else {
            if (hash != interfaceHash) {
                // jndi.88=Interface hash mismatch, expected: {0}, received: {1}
                throw new java.rmi.server.SkeletonMismatchException(Messages
                        .getString("jndi.88", interfaceHash, hash)); //$NON-NLS-1$
            }
        }

        org.apache.harmony.jndi.provider.rmi.registry.RemoteReferenceWrapper server = (org.apache.harmony.jndi.provider.rmi.registry.RemoteReferenceWrapper) obj;

        switch (opnum) {

            case 0: { // getReference()

                call.releaseInputStream();

                javax.naming.Reference $result = server.getReference();

                try {
                    java.io.ObjectOutput out = call.getResultStream(true);
                    out.writeObject($result);
                } catch (java.io.IOException e) {
                    // jndi.89=Error marshalling return
                    throw new java.rmi.MarshalException(Messages
                            .getString("jndi.89"), e); //$NON-NLS-1$
                }

                break;
            }

            default:
                // jndi.8A=Invalid method number: {0}
                throw new java.rmi.UnmarshalException(Messages.getString(
                        "jndi.8A", opnum)); //$NON-NLS-1$
        }
    }

}
